package com.iweb.exception;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.HashMap;
import java.util.Map;

/**
 * 南京艾瑞
 * 作者: jack
 * 时间: 2020-06-29 16:11
 * 描述: CustomHandler
 */
@RestControllerAdvice
public class CustomHandler {

    @ExceptionHandler(value = RuntimeException.class)
    public Map<String, Object> handler(Exception e) {
        Map<String, Object> result = new HashMap<>();
        result.put("code", "40000");
        result.put("message", e.getMessage());
        result.put("flag", false);
        return result;
    }

}
